package com.doubao.notepad_blog_backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doubao.notepad_blog_backend.domain.BmsPost;
import com.doubao.notepad_blog_backend.dto.CreatePostDTO;
import com.doubao.notepad_blog_backend.vo.PostVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface BmsPostMapper extends BaseMapper<BmsPost> {

    Page<PostVO> selectListAndPage(@Param("page") Page<PostVO> page, @Param("tab") String tab);

    BmsPost createPost(String userName, CreatePostDTO createPostDTO);

    Map<String, Object> getPostById(String id);

    List<BmsPost> getRecommend(String id);

    BmsPost updateById(String userName, BmsPost post);

    void deleteById(String userName, String id);

    Page<PostVO> searchByKey(@Param( "keyword" ) String keyword, Page<PostVO> page);
}
